package com.jzd1997.lesson6;

import org.junit.Test;

import java.util.*;

/**
 * @Author: jiangzd
 * @Date: 18:38 2019/7/23
 */
public class TestDecorate {
    public static void main(String[] args){
        Person xc = new Person("小菜");
        System.out.println("第一种装扮");
        Snearker pqx = new Snearker();
        BigTrouser kk = new BigTrouser();
        TShirt dtx = new TShirt();
        pqx.Decorate(xc);
        kk.Decorate(pqx);
        dtx.Decorate(kk);
        dtx.show();

        System.out.println("第二种装扮");
        LeatherShoes px = new LeatherShoes();
        Tie ld = new Tie();
        Suit xz = new Suit();
        px.Decorate(xc);
        ld.Decorate(px);
        xz.Decorate(ld);
        xz.show();
    }

    @Test
    public void testForeach(){
        List<String> students = new ArrayList<String>();
        students.add("jiangzd");
        students.add("yuxiao");
        students.forEach(item->System.out.println(item));
    }

    @Test
    public void testMapForEach(){
        Map<String,Object> student= new LinkedHashMap<String,Object>();
        student.put("jiangzd",new Integer(59));
        student.put("yuxiao",new Integer(45));
        student.forEach((key,value)->{
            System.out.printf("Name:%s Score:%d \n",key,value);
        });
    }
}
